
package com.ft.core.exceptions;

import com.ft.core.exceptions.inner.FanTuException;

/**
 * @copyright (C), 2015-2019, XXX有限公司
 * @fileName: UserFriendlyException
 * @author: Lee
 * @date: 2019/4/17 9:52
 * @description: 用户友好异常
 */
public class UserFriendlyException extends FanTuException {
    private static final long serialVersionUID = 6766792799793706955L;
    /**
     * 无构造实例化
     */
    public UserFriendlyException() {
        super();
        this.setCode(UserFriendlyErrorCode.USER_FRIENDLY_ERROR_CODE);
    }

    /**
     * 实例化
     *
     * @param message 消息
     */
    public UserFriendlyException(String message) {
        super(message);
        this.setCode(UserFriendlyErrorCode.USER_FRIENDLY_ERROR_CODE);
    }

    /**
     * 实例化
     *
     * @param message 消息
     * @param cause   源异常
     */
    public UserFriendlyException(String message, Throwable cause) {
        super(message, cause);
        this.setCode(UserFriendlyErrorCode.USER_FRIENDLY_ERROR_CODE);
    }

    /**
     * 实例化
     *
     * @param cause 源异常
     */
    public UserFriendlyException(Throwable cause) {
        super(cause);
        this.setCode(UserFriendlyErrorCode.USER_FRIENDLY_ERROR_CODE);
    }

    /**
     * 实例化
     *
     * @param message            消息
     * @param cause              源异常
     * @param enableSuppression
     * @param writableStackTrace 写入跟踪
     */
    protected UserFriendlyException(String message, Throwable cause, boolean enableSuppression,
                                   boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.setCode(UserFriendlyErrorCode.USER_FRIENDLY_ERROR_CODE);
    }

    @Override
    public final ExceptionLevel getLevel() {
        return ExceptionLevel.USER;
    }
}
